// 发行端空位计算mixin  pagesA/goonLarpManager/detail
export default {
	computed:{
		userSmallDtos(){
			return this.item.userSmallDtos || []
		},
		manLen(){
			return this.userSmallDtos.filter(val=>val.gender==='男').length || 0
		},
		womanLen(){
			return this.userSmallDtos.filter(val=>val.gender==='女').length || 0
		},
		participate(){
			return this.manLen + this.womanLen || 0
		},
		//人数剩余展位
		womanEmptyLen(){ //女空位
			const {people,mpeople,participate} = this.item;
			const womanP = people - mpeople;
			if(womanP==0 || participate===people) return 0;
			if(this.manLen==0&&this.womanLen==0) return  womanP //如果未加入女生则直接返回女生空位
			if(this.manLen>0){
				const manPeople =  this.manLen>mpeople ? this.manLen : mpeople  //可反串的情况下 如果上车人数大于设置人数则使用上车人数
				const p = people - this.womanLen - manPeople
				return p>0 ? p : 0
			} 
			if(this.womanLen>0){
				const womanPeople = people - mpeople -  this.womanLen; //总人数减去男生数量再减去女生数量得到男生空位
				return womanPeople>0 ? womanPeople : 0
			}
		},
		manEmptyLen(){ //男空位
			const {people,mpeople,participate} = this.item;
			if(mpeople==0 || participate===people) return 0
			if(this.manLen==0&&this.womanLen==0)  return mpeople
			let womanPeople = people - mpeople; //获取女生人数
			if(this.womanLen>womanPeople) womanPeople = this.womanLen //可反串的情况下 如果上车人数大于设置人数则使用上车人数
			if(this.womanLen>0){
				const p = people - womanPeople - this.manLen
				return p>0 ? p : 0
			} 
			if(this.manLen>0){
				const manPeople = people - womanPeople -  this.manLen; //总人数减去女生数量再减去男生数量得到男生空位
				return manPeople>0 ? manPeople : 0
			}
		},
		isCity(){
			return ['城限','独家'].includes(this.item.issueModeName)
		},
	}
}